<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<c:set var="path" value="${pageContext.request.contextPath}" />
<!DOCTYPE HTML>
<html>
<jsp:include page="../../common/head.jsp"></jsp:include>
<link rel="stylesheet" type="text/css" href="${path}/lib/autocomplete/autocomplete.min.css" />
<body>
<article class="page-container">
	<form id="form-grade-add" action="${path}/grade/add" method="post" class="form form-horizontal">
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-3"><span
						class="c-red">*</span>学生姓名：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" class="input-text" value="" placeholder="学生姓名"
							id="studentName" name="studentName"><span class="c-red">*可输入首字母进行补全,如周杰伦(输入zjl即可)</span>
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-3"><span
						class="c-red">*</span>课程名称：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" class="input-text" value="" placeholder="课程名称"
							id="className" name="className">
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-3"><span
						class="c-red">*</span>成绩：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" class="input-text" value="" placeholder="成绩"
							id="grade" name="grade">
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-3"><span
						class="c-red">*</span>学分：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" class="input-text" value="" placeholder="学分"
							id="credit" name="credit">
					</div>
				</div>
		<div class="row cl">
			<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
				<input class="btn btn-primary radius" type="submit"
						value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
			</div>
		</div>
	</form>
</article>
	
	<jsp:include page="../../common/foot.jsp"></jsp:include>
	<script type="text/javascript" src="${path}/js/grade/add.js"></script> 
	<script type="text/javascript" src="${path}/lib/autocomplete/autocomplete.min.js"></script> 
	<script type="text/javascript">
		$(function() {
			$("#form-grade-add").validate({
				rules : {
							grade:{
								required : true,
								number:true
							},
							credit:{
								required : true,
								number:true
							},
							studentName:{
								required : true
							},
							className:{
								required : true
							}
				},
				onkeyup : false,
				focusCleanup : true,
				success : "valid",
				submitHandler : function(form) {
					var $form=$(form);
					$.post($form.attr('action'),$form.serialize(),function(result){
						if(checkCode(result)){
							$form.find('input[type="text"],input[type="password"]').val('');
							layer.alert('添加成功', {
								  icon: 1,
								  skin: 'layer-ext-moon' //该皮肤由layer.seaning.com友情扩展。关于皮肤的扩展规则，去这里查阅
							});
						}
					},'json').error(function(){
						serverError();
					});
				}
			});
		});
	</script>
</body>
</html>